# -*- coding: utf-8 -*-
from enum import Enum, unique

@unique
class Environment(Enum):
    """
    环境枚举类
    LOCAL: 本地开发环境
    TEST: 测试环境
    GRAY: 灰度环境
    PROD: 生产环境
    """
    LOCAL = "local"
    TEST = "test"
    GRAY = "gray"
    PROD = "prod"

    @classmethod
    def get_current_env(cls) -> 'Environment':
        """
        获取当前环境，默认为本地环境
        可以通过环境变量 PROXY_ENV 设置
        """
        import os
        env = os.getenv("env", "local").lower()
        try:
            return cls(env)
        except ValueError:
            return cls.LOCAL 